home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / MacHacksBug / Python 1.5.2c1 / Mac / Tools / macfreeze / directives.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2000-06-23  |  1.3 KB  |  33 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import re
  5. import os
  6. DIRECTIVE_RE = '^\\s*#\\s*macfreeze:\\s*(\\S*)\\s*(.*)\\s*$'
  7. REPROG = re.compile(DIRECTIVE_RE)
  8.  
  9. def findfreezedirectives(program):
  10.     extra_modules = []
  11.     exclude_modules = []
  12.     extra_path = []
  13.     (progdir, filename) = os.path.split(program)
  14.     fp = open(program)
  15.     for line in fp.readlines():
  16.         match = REPROG.match(line)
  17.         if match:
  18.             directive = match.group(1)
  19.             argument = match.group(2)
  20.             if directive == 'include':
  21.                 extra_modules.append(argument)
  22.             elif directive == 'exclude':
  23.                 exclude_modules.append(argument)
  24.             elif directive == 'path':
  25.                 argument = os.path.join(progdir, argument)
  26.                 extra_path.append(argument)
  27.             else:
  28.                 print '** Unknown directive', line
  29.         
  30.     
  31.     return (extra_modules, exclude_modules, extra_path)
  32.  
  33.